//
//  MainViewController.m
//  TestApplication
//
//  Created by Hanlingyu on 16/8/26.
//  Copyright © 2016年 ltq. All rights reserved.
//

#import "MainViewController.h"
#import "ExplorationViewController.h"
#import "MessageViewController.h"
#import "ChatViewController.h"
#import "SelfViewController.h"
#import "HomeViewController.h"
#import "BaseNavigationController.h"
@interface MainViewController ()

@end

@implementation MainViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    // 创建一系列ViewController
    
    self.tabBar.tintColor = [UIColor colorWithRed:0.000 green:0.933 blue:0.933 alpha:1.000];
    self.navigationController.navigationBar.barStyle = 0;
    
    
    HomeViewController *homeVC = [[HomeViewController alloc] init];
    ExplorationViewController *explorationVC = [[ExplorationViewController alloc] init];
    MessageViewController *messageVC = [[MessageViewController alloc] init];
    ChatViewController *chatVC = [[ChatViewController alloc] init];
    SelfViewController *selfVC = [[SelfViewController alloc] init];
    
    
    BaseNavigationController *homeNaVC = [[BaseNavigationController alloc] initWithRootViewController:homeVC];
    homeNaVC.navigationBar.barStyle = 0;
    BaseNavigationController *explorationNaVC = [[BaseNavigationController alloc] initWithRootViewController:explorationVC];

    BaseNavigationController *messageNaVC = [[BaseNavigationController alloc] initWithRootViewController:messageVC];

    BaseNavigationController *chatNaVC = [[BaseNavigationController alloc] initWithRootViewController:chatVC];

    BaseNavigationController *selfNaVC = [[BaseNavigationController alloc] initWithRootViewController:selfVC];

    
    homeNaVC.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"Young" image:[UIImage imageNamed:@"feedTabBar"] selectedImage:[UIImage imageNamed:@"feedTabBarHighLight"]];
    chatNaVC.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"聊天" image:[UIImage imageNamed:@"chatTabBar"] selectedImage:[UIImage imageNamed:@"chatTabBarHighLight"]];
    explorationNaVC.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"探索" image:[UIImage imageNamed:@"findTabBar"] selectedImage:[UIImage imageNamed:@"findTabBarHighLight"]];
    messageNaVC.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"消息" image:[UIImage imageNamed:@"notifyTabBar"] selectedImage:[UIImage imageNamed:@"notifyTabBarHighLight"]];
    selfNaVC.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"个人" image:[UIImage imageNamed:@"userTabBar"] selectedImage:[UIImage imageNamed:@"userTabBarHighLight"]];
    
    [homeNaVC.tabBarItem setTitlePositionAdjustment:UIOffsetMake(0, -5)];
    [chatNaVC.tabBarItem setTitlePositionAdjustment:UIOffsetMake(0, -5)];
    [explorationNaVC.tabBarItem setTitlePositionAdjustment:UIOffsetMake(0, -5)];
    [messageNaVC.tabBarItem setTitlePositionAdjustment:UIOffsetMake(0, -5)];
    [selfNaVC.tabBarItem setTitlePositionAdjustment:UIOffsetMake(0, -5)];

    NSArray *array = @[homeNaVC, chatNaVC, explorationNaVC, messageNaVC, selfNaVC];
    self.viewControllers = array;
    self.tabBar.barStyle = UIBarStyleDefault;
    self.tabBar.barTintColor = [UIColor whiteColor];

    

}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
    
    
    
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
